dojo.provide('app.form.RegisterItem');
dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
dojo.require('dojo.i18n');
dojo.requireLocalization('app.i18n');

dojo.declare('app.form.RegisterItem', [ dijit._Widget, dijit._Templated ], {
	templateString : dojo.cache('app.form', 'RegisterItem.html'),
	_addressLabel:'',
	_countryLabel:'',
	_nameLabel:'',
	viewLink:'',
	deleteLink:'',
	name:'',
	address:'',
	country:'',
	attributeMap : {
		name:{node:'nameValueNode',type:'innerHTML'},
		address:{node:'addressValueNode',type:'innerHTML'},
		country:{node:'countryValueNode',type:'innerHTML'}
	},
	constructor : function(args) {
		this.inherited(arguments);
		this._nameLabel = '';
		this._addressLabel = dojo.i18n.getLocalization('app.i18n').register_label_address;
		this._countryLabel = dojo.i18n.getLocalization('app.i18n').register_label_country;
		this._deleteLinkLabel = dojo.i18n.getLocalization('app.i18n').delete_label;
		this._viewLinkLabel = dojo.i18n.getLocalization('app.i18n').view_label;
	},
	buildRendering : function() {
		this.inherited(arguments);
		console.group('buildRendering');
		console.log(this.item);
		console.groupEnd();
		var ct = this.item.contact;
		var addr = this.item.address;
		var nInfLbl = dojo.i18n.getLocalization('app.i18n').not_informed_label
		this.set('name',ct && ct.name || nInfLbl);
		this.set('address',addr && addr.description || nInfLbl);
		this.set('country',ct && ct.country && ct.country.description || nInfLbl);
	},
	onDeleteClick:function(e){
		
	},
	onViewClick:function(e){
		
	}
});